#include<stdio.h>
#include<stdlib.h>
#include<glob.h>

void main(int argc, char *argv[])
{
    //char pattern[64]="/home/bobzhang/os/work/openwrt/kata/*";
    char pattern[64]="/dev/*";
    glob_t globbuf;
    int size, i;
    int ret = 0;

    if (ret = glob(pattern, GLOB_MARK, NULL, &globbuf) != 0) {
        printf("glob error, ret=[%d]\n", ret);
    }

    printf("globbuf.gl_pathc=[%d]\n", globbuf.gl_pathc);
    for(i = 0; i < globbuf.gl_pathc; i++) {
        printf("file path[%d]=[%s]\n", i, globbuf.gl_pathv[i]);
    }
    globfree(&globbuf);
}
